package com.meelive.ingkee.push.platform.vivo;

import android.content.Context;
import android.util.Log;

import com.meelive.ingkee.push.InkePushHelper;
import com.meelive.ingkee.push.model.Constance;
import com.meelive.ingkee.push.model.InkePushType;
import com.meelive.ingkee.push.common.PushUtils;
import com.vivo.push.model.UPSNotificationMessage;
import com.vivo.push.model.UnvarnishedMessage;
import com.vivo.push.sdk.OpenClientPushMessageReceiver;

/**
 * Create by: fanfeiyue
 * on: 2019-08-22
 * desc: 为避免造成用户打扰，目前vivo手机接收的消息为7:00-23:00，服务器允许推送时间为7:00-22:00，单推不受此时间限制。
 * 在限制时间之外发送的群推或全推，会被抛弃，但是不计算在发送次数限制中。
 * vivo支持推送
 */
public class InkeVivoMsgReceiver extends OpenClientPushMessageReceiver {

    @Override
    public void onNotificationMessageClicked(Context context, UPSNotificationMessage upsNotificationMessage) {
        if (context == null || upsNotificationMessage == null) {
            return;
        }
        if (PushUtils.DEBUG) {
            Log.d(Constance.TAG, "InkeVivoMsgReceiver onNotificationMessageClicked is called. " + upsNotificationMessage.toString());
        }
        InkePushHelper.getInstance().onNotificationClick(context, upsNotificationMessage.getSkipContent(), InkePushType.VIVOPUSH);
    }

    @Override
    public void onTransmissionMessage(Context context, UnvarnishedMessage unvarnishedMessage) {
        if (context == null || unvarnishedMessage == null) {
            return;
        }
        if (PushUtils.DEBUG) {
            Log.d(Constance.TAG, "InkeVivoMsgReceiver onNotificationMessageClicked is called. " + unvarnishedMessage.toString());
        }
        InkePushHelper.getInstance().onPassThroughPush(context, unvarnishedMessage.getMessage(), InkePushType.VIVOPUSH);
    }

    @Override
    public void onReceiveRegId(Context context, String s) {
        InkePushHelper.getInstance().onReceiveToken(InkePushType.VIVOPUSH, s);
    }
}
